home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 345 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: solon.com!not-for-mail
  2. From: diamond@tko.dec.com (Norman Diamond)
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: Integral promotion.
  5. Date: 21 Feb 1996 08:42:05 -0600
  6. Organization: Digital Equipment Corporation Japan , Tokyo
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4gfavt$21b@solutions.solon.com>
  10. References: <4fstj7$2l6@solutions.solon.com> <4fu835$9de@solutions.solon.com> <4fvgrm$dv9@solutions.solon.com> <4g28hr$qko@solutions.solon.com> <4g54pv$ajt@solutions.solon.com>
  11. Reply-To: diamond@jrdv04.enet.dec-j.co.jp (Norman Diamond)
  12. NNTP-Posting-Host: solutions.solon.com
  13.  
  14. In article <4g54pv$ajt@solutions.solon.com>, msb@sq.com writes:
  15. >I wrote:
  16. >>> Thus even in ANSI C, if this function is called this way:
  17. >>>extern short p, q, r, test(short,short);
  18. >>>r = test(p,q);
  19. >>> the values from p and q are still converted from short to int and back
  20. >>> to short.  
  21.  
  22. >Thad Smith (ThadSmith@acm.org) responded:
  23. >>I find nothing in the Standard that states that the arguments undergo
  24. >>integral promotions before being assigned to the function parameters.
  25.  
  26. >This is in 6.2.1.1/3.2.1.1, the passage which defines the integral
  27. >promotions.  It states that the promotions apply
  28. >#  in an expression wherever an int or unsigned int may be used.
  29.  
  30. It does not.  6.2/3.2 begins with the sentence:  "Several operators
  31. convert values from one type to another automatically."  The entire
  32. section proceeds to describe what kinds of conversions occur in which
  33. kinds of contexts, all within the context of which operators convert
  34. values automatically.  The entire section is irrelevant to other
  35. contexts, such as those in which operators do not convert values
  36. automatically (e.g. postfix ++, e.g. function call, e.g. sizeof,
  37. even e.g. assignment when the left and right sides have the same type).
  38.  
  39. Part of the definition of the binary + operator is to perform the
  40. integral promotions on its operands.  There is stuff like this all
  41. over the chapter on expressions.  If all this stuff were unnecessary,
  42. they might not have repeated it 20 times, or it might have been caught
  43. and submitted as a defect report many years ago.
  44.  
  45. You miscorrected Chris Torek and you made him believe you.  You
  46. miscorrected Thad Smith and me, but we aren't falling for it.
  47. --
  48.  <<  If this were the company's opinion, I would not be allowed to post it.  >>
  49. "I paid money for this car, I pay taxes for vehicle registration and a driver's
  50. license, so I can drive in any lane I want, and no innocent victim gets to call
  51. the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
  52.